package ru.electron.menu.fragments;

import android.os.Bundle;
import android.support.v4.app.ListFragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.TextView;
import ru.electron.menu.R;

public abstract class AbstractListFragment extends ListFragment {


    public abstract String getHeader();

    public abstract ListAdapter getListAdapter();

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View layout = inflater.inflate(R.layout.header_list, container, false);
        TextView header = (TextView) layout.findViewById(R.id.header);
        header.setText(getHeader());
        ListView listView = (ListView) layout.findViewById(android.R.id.list);
        listView.setAdapter(getListAdapter());
        return layout;
    }


}
